﻿using AutoMapper;
using MediatR;
using SheepStorage.API.Application.Command.SheepDeathCommand;
using SheepStorage.API.Application.Command.SheepMarkCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.SheepDeathHandler
{
    public class SheepDeathEditCommandHandler : IRequestHandler<SheepDeathEditCommand, Results<SheepDeath>>
    {
        private readonly ISheepDeathService _sheepDeathService;
        private readonly IMapper _mapper;
        public SheepDeathEditCommandHandler(ISheepDeathService sheepDeathService, IMapper mapper)
        {
            _sheepDeathService = sheepDeathService;
            _mapper = mapper;
        }
        /// <summary>
        /// 戴标反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<Results<SheepDeath>> Handle(SheepDeathEditCommand request, CancellationToken cancellationToken)
        {
            return Results<SheepDeath>.DataResult(await _sheepDeathService.GetSheepDeath(request.SheepDeathId));
        }
    }
} 
